package com.un.ebs.order.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.un.ebs.order.domain.OrderExt;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * 2 Mapper 接口
 * </p>
 *
 * @author liubo
 * @since 2020-05-15
 */
@Component
public interface OrderExtMapper extends BaseMapper<OrderExt> {

    @SqlParser(filter = true)
    @Select("select * from v_order_ext where id=#{id}")
    OrderExt queryById(String id);

    @SqlParser(filter = true)
    @Select("select top 50 * from v_order_ext where submit_status=1 and ((expire_day<=-1 and expire_default_day>0) OR (real_min_money>real_money AND DATEDIFF(HOUR,submit_time,GETDATE())>=24))")
    List<OrderExt> queryExpire();
}
